/*
 * Copyright 2023-2085 xujin <ceo@itgrail.com>
 *
 * Licensed under the Grail License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://itgrail.com/docs?id=3&catalogId=87
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.itgrail.pilot.domain.user.entity;

import com.itgrail.pilot.domain.user.repository.ObjectiveRepository;
import lombok.Data;
import com.itgrail.grail.ddd.annotation.domain.DomainAbility;
import com.itgrail.grail.ddd.annotation.domain.Entity;

import java.sql.Timestamp;

@Entity
@Data
public class ObjectiveE {
    private ObjectiveRepository repository;

    /**
     * 主键
     */
    private Integer id;

    /**
     * 目标名称
     */
    private String name;

    /**
     * 进度记录
     */
    private String planRecord;

    /**
     * 进度
     */
    private Integer planRate;

    /**
     * 权重
     */
    private Integer weightRate;

    /**
     * 总分
     */
    private String scoreRate;

    /**
     * 记录创建时间，默认当前时间
     */
    private Timestamp createTime;

    /**
     * 记录更新时间，默认当前时间
     */
    private Timestamp updateTime;

    /**
     * 是否删除 0 未删除 1 删除 默认是0
     */
    private Byte deleted;

    /**
     * 创建人
     */
    private Integer created;

    /**
     * 更新人
     */
    private Integer updated;

    /**
     * 周期id
     */
    private Integer okrPeriodId;

    /**
     * 分类id
     */
    private Integer classifyId;

    /**
     * 对齐数量
     */
    private Integer alignCount;

    private Integer showSort;

    private String myScore;
    private String myEvaluate;
    private String leaderScore;
    private String leaderEvaluate;

    private String notifyUserList;


    @DomainAbility
    public int save() {
        return repository.save(this);
    }

    @DomainAbility
    public int update() {
        return repository.update(this);
    }

    public int delete() {
        return repository.delete(this);
    }
}
